#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   convert_mysql_to_jsonL.py.py    
@Contact :   fengfeng.qiu@amh-group.com

@Modify Time      @Author    
------------      -------    
2022/8/25 10:02   qiufengfeng      
'''
import ast


from qiu_utils.db_utils.mysql_utls import MysqlConnector
from price_extra import price_extract
MYSQL_INFO = {
    'host':"10.13.68.93",
    "port":3306,
    "user":"root",
    'passwd':"123456",
    'db':"contraband",
    "charset":"utf8"
}
table_name = "biaozhu_price"
mysql_instance = MysqlConnector(MYSQL_INFO,table_name)
label_df = mysql_instance.select(['id','text','label'],{})
label_df = label_df[label_df["label"] != ""]

def change_label(label):
    return ast.literal_eval(label)
label_df['label'] = label_df['label'].apply(change_label)
label_df.to_json("mysql.jsonl",orient="records",lines=True)
